package br.edu.unicentro.mymib.entity;

import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorValue("Pessoa")
@NamedQueries( { @NamedQuery(name = "pessoa.findByEmail", query = "from Pessoa as p where p.email = :email") })
public class Pessoa extends Entidade {

	@Id
	@GeneratedValue
	protected Long id;

	@Column(unique = true)
	protected String email;

	protected String nome;
	protected String senha;

	public Pessoa() {
	}

	public Long getId() {
		return id;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public void setSenha(String senha) {
		this.senha = senha;
	}

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public String getEmail() {
		return email;
	}
	
	public boolean validarSenha(String senha) {
		return (this.senha.equals(senha));
	}

}
